/////////////////////////
// 	DDCHECKBOX.h	:	v0010
//	Written by 	:	Li	Haijun
//	Compiler	:	Microsoft Visual C++ 4.0
//	v0010		:	Nov.13.1996
/////////////////////////

/////////////////////////////////////////////////////////////////////////////
// CDDMenu class
#ifndef __DDCHECKBOX_H__
#define __DDCHECKBOX_H__

#include	"ddapi.h"
#include	"Marco.h"

/////////////////////////////////////////
// to test whether a check-box is clicked  --- WM_LcheckboxDOWN
/////////////////////////////////////////
BOOL	LeftButtonDownOnCheckBox(int xPos, int yPos);
// to test whether cursor is on current check-box when left checkbox up --- WM_LcheckboxUP
BOOL	LeftButtonUpOnCheckBox(int xPos, int yPos);
// to test whether cursor is moved on a check-box --- WM_ONMOUSEMOVE
BOOL	MouseMoveOnCheckBox(WPARAM wParam,int xPos, int yPos);
/////////////////////////////////////////////////////////////
//	to delete all bitmap of checkbox when you exit this game
void	FACE_DeleteAllCheckBox(void);
/////////////////////////////////////////////////////////////
//	to blit all bitmap of checkbox . This funciton is just for the class CDDMenu
void	FACE_BlitAllCheckBox(void);
/////////////////////////////////////////

class	CDDCheckBox
{
//data member
private:
// the surface that this checkbox is load on
	CDDSurface	m_BitmapSurface;
// Attributes
public:
	int		m_nFileNameId;	// name of this DIB file name
	SIZE	m_szOneBitmap;	// the size of one state of a bitmap checkbox
	RECT	m_rTotal;		// there is four state of a bitmap checkbox in a DIB file	
	RECT	m_rCurrent;		// the rectangle of current state bitmap checkbox
	int		m_dwX, m_dwY;	// the position of a bitmap checkbox on the surface
	BOOL	m_bSet;			// to flag if this checkbox is setted
							//	0 --> not set ;  1 --> is setted
	int  m_nID;		// checkbox id
	int  m_nState;	// checkbox state,0-up,1-down,2-disable,3-focus
	int  m_nPart;	// how many part should the dib image file be devided
					// that means,how many state image in one dib file

	BOOL m_bEnableSound;	// true for enable sound effects
//member function
public:
	// construct
	CDDCheckBox();
	// disconstruct
	~CDDCheckBox();
	// to preload the bitmap file of this check-box
	BOOL	PreLoad(int FilenameId, int x, int y,
						int OneBitmapWidth=0, int OneBitmapHeight=0);
	// to release this check-box's bitmap surface
	void	Release(void);
	// to set the id of this check-box
	void	SetID(int ID);
	// to set the state of this check-box
	void	SetState( int state = -1 );
	// to get the state of this check-box
	int		GetState(void);
	// to send a message when you changed the state of a check-box
	void	SendMessage(int	state) ;
	// to get the size of this check-box
	SIZE	GetSize(void){return m_szOneBitmap;}
	// to judge whether mouse is on this check-box
	BOOL	OnCheckBox( int x, int y);
	// to show this check-box
	void	Show(void);
	// to blit this check-box to back buffer
	void	Blit(void);
	// to update the area of this check-box from back buffer to front buffer
	void	Update(void);
};
///////////////////////////////////////////////////////////////////////
// class declear
class CDDCheckBoxUnit
{
	// Data member
	public:
		CDDCheckBox *	m_pCheckBox[MAX_CHECKBOXINUNIT];
		int				m_nSerialNum;	//to record the serial number of the checkbox 
								// (in this checkbox-unit) that been clicked 
	public:
		// constuctor
		CDDCheckBoxUnit();
		~CDDCheckBoxUnit();
		// to set state of each checkbox that in this check-unit
		void	SetMemberState( int state );
		// to show all checkbox in this checkbox-unit
		void	Show( );
		// to blit all check-boxes in this checkbox-unit to back buffer
		void	Blit( );
		// to update the area of every checkbox in this checkbox-unit from back buffer to front buffer
		void	Update( );
		// to release all checkbox in this checkbox-unit
		void	Release();
};


///////////////////////////////////
#endif